package com.ruoyi.business.service.impl;

import com.ruoyi.common.utils.SecurityUtils;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.BusOrderInfoMapper;
import com.ruoyi.business.domain.BusOrderInfo;
import com.ruoyi.business.service.IBusOrderInfoService;

/**
 * 订单记录Service业务层处理
 *
 * @author lzq
 * @date 2022-10-22
 */
@Service
public class BusOrderInfoServiceImpl implements IBusOrderInfoService
{
    @Autowired
    private BusOrderInfoMapper busOrderInfoMapper;

    /**
     * 查询订单记录
     *
     * @param id 订单记录主键
     * @return 订单记录
     */
    @Override
    public BusOrderInfo selectBusOrderInfoById(Long id)
    {
        return busOrderInfoMapper.selectBusOrderInfoById(id);
    }

    /**
     * 查询订单记录列表
     *
     * @param busOrderInfo 订单记录
     * @return 订单记录
     */
    @Override
    public List<BusOrderInfo> selectBusOrderInfoList(BusOrderInfo busOrderInfo)
    {
        return busOrderInfoMapper.selectBusOrderInfoList(busOrderInfo);
    }

    /**
     * 新增订单记录
     *
     * @param busOrderInfo 订单记录
     * @return 结果
     */
    @Override
    public int insertBusOrderInfo(BusOrderInfo busOrderInfo)
    {
        busOrderInfo.setCreateTime(DateUtils.getNowDate());
        busOrderInfo.setCreateBy(SecurityUtils.getUsername());
        return busOrderInfoMapper.insertBusOrderInfo(busOrderInfo);
    }

    /**
     * 修改订单记录
     *
     * @param busOrderInfo 订单记录
     * @return 结果
     */
    @Override
    public int updateBusOrderInfo(BusOrderInfo busOrderInfo)
    {
        busOrderInfo.setUpdateBy(SecurityUtils.getUsername());
        busOrderInfo.setUpdateTime(DateUtils.getNowDate());
        return busOrderInfoMapper.updateBusOrderInfo(busOrderInfo);
    }

    /**
     * 批量删除订单记录
     *
     * @param ids 需要删除的订单记录主键
     * @return 结果
     */
    @Override
    public int deleteBusOrderInfoByIds(Long[] ids)
    {
        return busOrderInfoMapper.deleteBusOrderInfoByIds(ids);
    }

    /**
     * 删除订单记录信息
     *
     * @param id 订单记录主键
     * @return 结果
     */
    @Override
    public int deleteBusOrderInfoById(Long id)
    {
        return busOrderInfoMapper.deleteBusOrderInfoById(id);
    }
}
